//
//  AdvertisementOperation.m
//  alotOf
//
//  Created by Mac_Black_Mini on 2025/9/5.
//

#import "AdvertisementOperation.h"
#import "Tools.h"
#import <ADSDK/SuperADLib.h>
NS_ASSUME_NONNULL_BEGIN

@implementation AdvertisementOperation
/// 显示一个广告 config: 1/2
+(void)showAdWithConfig:(NSString *)config {
    // vip 不显示
//    if (self.isVip) return;
    
    NSArray <NSString *>*configs = [config componentsSeparatedByString:@"/"];
    if (configs.count < 2) return;
    BOOL needShow = configs.firstObject.boolValue;
    if (!needShow) return;
    NSInteger type = [configs[1] integerValue];
    UIViewController *vc = [[Tools window] rootViewController];
    if (type == 1) {
        [SuperADLib.shared showOpenAdAt:vc complete:^(BOOL result) {
            NSLog(@"result:%d",result);
        }];
    } else if (type == 2) {
        [SuperADLib.shared showInsertAdAt:vc complete:^(BOOL result) {
            NSLog(@"result:%d",result);
        }];
    } else if (type == 3) {
        [SuperADLib.shared showRewardAdAt:vc complete:^(BOOL result) {
            NSLog(@"result:%d",result);
        }];
    }
}
@end

NS_ASSUME_NONNULL_END
